package com.devbobcorn.donutopia.world.structure;

import com.devbobcorn.donutopia.Donutopia;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.WorldGenRegistries;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.placement.IPlacementConfig;
import net.minecraft.world.gen.placement.Placement;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@EventBusSubscriber(modid = Donutopia.MODID, bus = EventBusSubscriber.Bus.MOD)
public class ModFeatures {
	private static final Logger LOGGER = LogManager.getLogger(Donutopia.MODID + " Features");

	public static final Feature<NoFeatureConfig> CANDY_CANE = new CandyCaneFeature(NoFeatureConfig.CODEC);
	public static final ConfiguredFeature<?,?> CANDY_CANE_C = CANDY_CANE.configured(NoFeatureConfig.INSTANCE).decorated(Placement.NOPE.configured(IPlacementConfig.NONE));
	public static final Feature<NoFeatureConfig> PAGODA = new PagodaStructure(NoFeatureConfig.CODEC);
	public static final ConfiguredFeature<?,?> PAGODA_C = PAGODA.configured(NoFeatureConfig.INSTANCE).decorated(Placement.NOPE.configured(IPlacementConfig.NONE));

	@SubscribeEvent
	public static void registerFeatures(RegistryEvent.Register<Feature<?>> event){
		event.getRegistry().register(CANDY_CANE.setRegistryName("candy_cane"));
		Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation(Donutopia.MODID, "candy_cane"), CANDY_CANE_C);
		event.getRegistry().register(PAGODA.setRegistryName("pagoda"));
		Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, new ResourceLocation(Donutopia.MODID, "pagoda"), PAGODA_C);

		LOGGER.info("Features Registered.");
	}
}
